﻿
#include "TestScene.h"
#include "SimpleAudioEngine.h"
#include "TableScene.h"

Scene* TestScene::createScene()
{
	return TestScene::create();
}

bool TestScene::init()
{
	if (!Scene::init())
	{
		return false;
	}
	//菜单类
	MenuItemFont* item1 = MenuItemFont::create("Menu1",CC_CALLBACK_1(TestScene::menuItem1Clicked,this));
	MenuItemFont* item2 = MenuItemFont::create("Menu2", CC_CALLBACK_1(TestScene::menuItem1Clicked, this));
	MenuItemFont* item3 = MenuItemFont::create("Menu3", CC_CALLBACK_1(TestScene::menuItem1Clicked, this));
	item1->setTag(1);
	item2->setTag(2);
	item3->setTag(3);
	Menu* menu = Menu::create(item1,item2,item3, NULL);
	menu->alignItemsVerticallyWithPadding(10.0f);		//垂直布局
	//menu->alignItemsHorizontallyWithPadding(10.0f);	//水平布局
	addChild(menu);

	return true;
}

void TestScene::menuItem1Clicked(Ref* sender) {
	MenuItem* item = (MenuItem*)sender;
	log("%d",item->getTag());
	Director::getInstance()->replaceScene(TransitionJumpZoom::create(3, TableScene::createScene()));
}

